home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softwarová Záchrana 3
/
Softwarova-zachrana-3.bin
/
Allway Sync
/
allwaysync-2-0-6.exe
/
{app}
/
Skins
/
default
/
profileex.js
< prev
next >
Wrap
Text File
|
2005-02-28
|
105KB
|
2,734 lines
// JavaScript Document
// Constants:
C_ERR_QUESTION = 6000;
C_CID = 'F3BDCACCA95444D6BBF419FDC8367C08';
C_ACTION_STATE_INIT = '43F4376C08254CE03299AB694B7A4E75';
C_ACTION_STATE_IN_PROGRESS = '58F511A98452E0FABC4099C03A33AB24';
C_ACTION_STATE_DONE = '9C2D0F16C7009B482E33617B81A6417E';
C_AssociationTemplate = '';
C_MESSAGES_ON_PAGE = 16;
// Global variables:
G_OnProfileChanged_called = false;
G_OnAssociationChanged_called = false;
G_CounterRefreshFlag = true;
G_AnalyzeHintCallCounter = 4;
G_Folders_is_ready = false;
//G_SynchronizeHintCallCounter = 3;
G_TabScrollingProcessNum = 0;
G_ActiveAssociationID = '';
G_Associations = new Array();
G_LastAssociationNumber = 1;
G_ProfileExist = false;
G_FirstAssociationID = '';
Flag_can_reload_profile = true;
function CreateTree(AssociationID, name,spanid) // main TreeView object
{
this._name=name; // name of object
this._spanid=spanid; // id of existing div used for treeview
this._associationID = AssociationID;
this._collections = new Array();
this._collectionIdByName = new Array();
this._image_collapsed="Pics/collapsed.gif";// images for parent nodes
this._image_expanded="Pics/expanded.gif";
this.root={ _id:name+"_root", // main node properties
_childrencount:0,
_children:[] // children array
};
this.build_root=function()
{
html_code = '<div id="'+this.root._id+'" >\n';
for(i in this.root._children)
{
html_code += this.build_collection(i);
}
html_code +='</div>';
return html_code;
};
this.build_collection=function(CollectionID)
{
if(this._collections[CollectionID].name == 'Important')
{
Is_important_messages = true;
}
else
{
Is_important_messages = false;
}
var collection = this.root._children[CollectionID];
var collection_html = '<div id="'+CollectionID+'">';
// msgs = external.ObjByID(CollectionID);
var msgs = this._collections[CollectionID].obj;
var CollectionChildrenCount = msgs.Method0('M_GetCount');
var AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
if(CollectionChildrenCount > 0) //Children exists, collection._empty == false
{
Important_sign = "";
if(Is_important_messages == true)
{
var AssociationElement = document.getElementById('Association_'+this._associationID);
AssociationElement.all['Important_warning'].style.visibility = "inherit";
var Important_sign = '<span><img src="Pics/warning_small.gif"></span> ';
}
collection._empty = false;
if(collection._expanded == 1)
{
var sub_collection_html = "";
var Prev_html = "";
var Next_html = "";
var firstMsgID = collection._first_disp_msg;
if(firstMsgID == null)
{
var msg = msgs.GetFirst();
if(msg != null)
{
collection._first_disp_msg = msg.objID;
collection._first_disp_msg_evenness = 1;
msg.SetM(CollectionID, 1); //???
}
else
{
collection._empty = true;
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
collection_html += '</div>\n\n';
return collection_html;
}
}
else
{
var msg = msgs.ObjByID(firstMsgID);
}
if(msgs.GetPrev(msg) != null)
{
var Prev_exist = true;
}
else
{
var Prev_exist = false;
}
//alert('Prev_html = '+Prev_html);
var i=0;
while((i < C_MESSAGES_ON_PAGE) && (msg!=null))
{
MsgEvenness = (collection._first_disp_msg_evenness+i)%2;
sub_collection_html += this.build_message(CollectionID,msg.objID, MsgEvenness);
i++;
msg = msgs.GetNext(msg);
}
if((i==C_MESSAGES_ON_PAGE)&&(msg!=null))
{
var Next_exist = true;
AdditionalAttributes.SetM('MM_FlagNotifyScript', false);
}
else
{
var Next_exist = false;
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
}
if((Prev_exist)||(Next_exist))
{
var MsgScrollersExist = true;
}
else
{
var MsgScrollersExist = false;
}
Prev_html = new CreateScrollControls("prev", Prev_exist, CollectionID, MsgScrollersExist);
Next_html = new CreateScrollControls("next", Next_exist, CollectionID, MsgScrollersExist);
//alert('Next_html = '+Next_html);
collection_html+='\n<div id="'+CollectionID+'_in" style="width:100%; position:relative; left:0;">\n'+
'<table class="ParentNode" border="0" cellpadding="0" cellspacing="0"><tr><td valign=middle align=center >'+
'<div style="width:30px;"><img onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" src="'+this._image_expanded+'"></div></td><td nowrap>'+
'<span class="CollectionName" onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" style="cursor:hand;">'+Important_sign+collection._caption+' (<span id="'+
CollectionID+'_caption">'+CollectionChildrenCount+'</span>)</span>';
collection_html+='</td><td width="100%"></td>'+
'<td id="TopPrev_end" valign="bottom" >'+Prev_html.top_end+'</td>'+
'<td id="TopPrev_page" valign="bottom" >'+Prev_html.top_page+'</td>'+
'<td id="TopPrev_msg" valign="bottom" >'+Prev_html.top_msg+'</td>'+
'<td id="TopNext_msg" valign="bottom" >'+Next_html.top_msg+'</td>'+
'<td id="TopNext_page" valign="bottom" >'+Next_html.top_page+'</td>'+
'<td id="TopNext_end" valign="bottom" >'+Next_html.top_end+'</td>'+
'</tr></table></div>\n';
collection_html += ''+ /*'<div class="MessageList"> '+*/
'<table class="MessageList" border="0" cellspacing="0" cellpadding="0"><tr>'+
'<td class="MsgCollectionScrollBar" style="width:16px; height:100%;">'+
'<table height="100%" width="16px" border="0" cellpadding="0" cellspacing="0" id="'+CollectionID+'_ScrollBar">'+
'<tr><td id="Prev_end">'+Prev_html.end+'</td></tr>'+
'<tr><td id="Prev_page">'+Prev_html.page+'</td></tr>'+
'<tr><td id="Prev_msg">'+Prev_html.msg+'</td></tr>'+
'<tr height="100%"><td height="100%"></td></tr>'+
'<tr><td id="Next_msg">'+Next_html.msg+'</td></tr>'+
'<tr><td id="Next_page">'+Next_html.page+'</td></tr>'+
'<tr><td id="Next_end">'+Next_html.end+'</td></tr>'+
'</table>'+
'</td>';
collection_html += '<td width="100%"><table id="'+CollectionID+'_container" width="100%" border="0" cellspacing="0" cellpadding="0" class="Collection_Table">'
+sub_collection_html+'</table></td></tr></table>'; //</div>
}
if(collection._expanded==0)
{
collection_html+='\n<div id="'+CollectionID+'_in" style="width:100%; position:relative; left:0;">\n'+
'<table class="ParentNode" border="0" cellpadding="0" cellspacing="0"><tr><td valign=middle align=center>'+
'<div style="width:30px;"><img onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" src="'+this._image_collapsed+'"></div></td><td nowrap>'+
'<span class="CollectionName" onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" style="cursor:hand;">'+Important_sign+collection._caption+' (<span id="'+
CollectionID+'_caption">'+CollectionChildrenCount+'</span>)</span> ';
collection_html+='</td><td width="100%"></td></tr></table></div>\n';
AdditionalAttributes.SetM('MM_FlagNotifyScript', false);
}
}
else //CollectionChildrenCount == 0
{
if(Is_important_messages == true)
{
AssociationElement = document.getElementById('Association_'+this._associationID);
AssociationElement.all['Important_warning'].style.visibility = "hidden";
}
collection._empty = true;
collection._first_disp_msg = null;
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
}
collection_html += '</div>\n\n';
return collection_html;
};
this.build_message=function(CollectionID, MsgID, MsgEvenness)
{
var msg = external.ObjByID(MsgID);
var message_html = FillMsgNode(msg, MsgEvenness);
msg.SetM(CollectionID, 1); //MM_FlagNotifyScript to 1
return message_html;
};
this.redraw=function() // function redraws whole treeview
{
var AssociationElement = document.getElementById('Association_'+this._associationID);
var ele = AssociationElement.all[this._spanid];
ele.innerHTML = this.build_root();
};
this.redraw_collection=function(CollectionID)
{
var AssociationElement = document.getElementById('Association_'+this._associationID);
var collection_element = AssociationElement.all[CollectionID];
collection_element.outerHTML = this.build_collection(CollectionID);
};
this.add_collection_node=function(msgs, collectionName, caption, expanded) // adds node
{
var CollectionID = msgs.objID;
this._collections[CollectionID] = {};
this._collections[CollectionID].obj = msgs;
this._collections[CollectionID].name = collectionName;
this._collectionIdByName[collectionName] = CollectionID;
var collection_node={};
collection_node._caption=caption;
collection_node._expanded=expanded;
// msgs = external.ObjByID(CollectionID);
if(expanded == 1)
{
var NotifyFlag = true;
}
else
{
var NotifyFlag = false;
}
if(msgs == null)
{
alert('add_collection_node: CollectionObj (msgs) == null');
collection_node._first_disp_msg = null;
collection_node._empty = true;
}
else
{
var AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
var first_message = msgs.GetFirst();
if(first_message == null)
{
collection_node._empty = true;
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
collection_node._first_disp_msg = null;
}
else
{
collection_node._first_disp_msg = first_message.objID;
collection_node._first_disp_msg_evenness = 1;
first_message.SetM(CollectionID, 1); //MM_FlagNotifyScript to 1
collection_node._empty = false;
AdditionalAttributes.SetM('MM_FlagNotifyScript', NotifyFlag);
}
}
this.root._childrencount++;
this.root._children[CollectionID]=collection_node;
return collection_node;
};
this.add_message_node=function(CollectionID,MsgID) // adds node
{
if(this._collections[CollectionID] != null)
{
var collection = this.root._children[CollectionID];
var msgs = this._collections[CollectionID].obj;
}
else
{
return;
}
// msgs = external.ObjByID(CollectionID);
if(msgs == null) alert('msgs == null');
var AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
var CollectionChildrenCount = msgs.Method0('M_GetCount');
if(collection._empty == true)
{
collection._empty = false;
collection._first_disp_msg = msgs.GetFirst().objID;
collection._first_disp_msg_evenness = 1;
msgs.ObjByID(collection._first_disp_msg).SetM(CollectionID, 1); //MM_FlagNotifyScript to 1
G_Associations[AssociationID].TreeView.redraw_collection(CollectionID);
return;
}
if(collection._expanded == 1)
{
var collection_container_element = document.getElementById('Association_'+this._associationID).all[CollectionID+'_container'];
var list_length = collection_container_element.children.length;
if((msgs.GetPrev(msgs.GetLast()).objID) == (collection_container_element.children(list_length-1).id))
{
if (list_length<C_MESSAGES_ON_PAGE)
{
var new_message_element = document.createElement('tbody');
collection_container_element.appendChild(new_message_element);
BuildMessageAsObject(new_message_element, CollectionID, MsgID, (collection._first_disp_msg_evenness+list_length)%2);
// alert("collection._first_disp_msg_evenness = "+collection._first_disp_msg_evenness+"\nlist_length = "+list_length);
}
else
{
RefreshMsgScrollers(document.getElementById('Association_'+this._associationID), "next", true, CollectionID, true);
RefreshMsgScrollers(document.getElementById('Association_'+this._associationID), "prev", false, CollectionID, true); //!! Debug line
AdditionalAttributes.SetM('MM_FlagNotifyScript', false);
}
}
}
};
this.click=function(CollectionID) // expands or collaps node
{
if(this.root._children[CollectionID]._expanded == 1)
{
var collection_container = document.getElementById('Association_'+this._associationID).all[CollectionID+'_container'];
var msgs = this._collections[CollectionID].obj;
// msgs = external.ObjByID(CollectionID);
var list_length = collection_container.children.length;
for(i=1; i<list_length; i++)
{
msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null); //MM_FlagNotifyScript to null
}
}
this.root._children[CollectionID]._expanded=1-this.root._children[CollectionID]._expanded;
this.redraw_collection(CollectionID);
};
return this;
}; // CreateTree() ends
function Body_onload()
{
ApplicationName.innerText = external.GetAppName();
BannerSlogan.innerText = external.LS("banner_slogan");
VersionInBanner.innerHTML = 'ver. '+external.GetAppVersionUserStr();
C_AssociationTemplate = AssociationTemplate.innerHTML;
LoadProfile();
ActivateAssociation(G_ActiveAssociationID);
ExtUpdateButtons(G_ActiveAssociationID);
CountersRefreshAtTimes();
}
function LoadProfile()
{
var profile = external.Method0Own('M_GetProfile');
if(profile == null)
{
G_ProfileExist = false;
return false;
}
G_ProfileExist = true;
var AssociationObj = profile.GetFirst();
// G_FirstAssociationID = AssociationObj.objID;
var Associations_exist = false;
if(AssociationObj == null)
{
return false;
}
var FirstAssociationID = AssociationObj.objID;
var ActiveAssociation_exist = false;
while(AssociationObj != null)
{
if(G_ActiveAssociationID == AssociationObj.objID)
{
ActiveAssociation_exist = true;
}
AddAssociation(AssociationObj);
var AssociationObj = profile.GetNext(AssociationObj);
}
/* if(ActiveAssociation_exist == true)
{
ActivateAssociation(G_ActiveAssociationID);
}
else
{
ActivateAssociation(FirstAssociationID);
} */
if(ActiveAssociation_exist != true)
{
G_ActiveAssociationID = FirstAssociationID;
}
// ExtUpdateButtons(G_ActiveAssociationID);
return true;
}
function InitAssociation(AssociationObj) // initialisation of association
{
AssociationID = AssociationObj.objID;
G_Associations[AssociationID]={};
G_Associations[AssociationID].self=AssociationID;
G_Associations[AssociationID].Folders_is_ready = false;
G_Associations[AssociationID].Folder_1_is_ready = false;
G_Associations[AssociationID].Folder_2_is_ready = false;
G_Associations[AssociationID].OnAssociationChangedCalled = false;
G_Associations[AssociationID].TreeView = new CreateTree(AssociationID, "tree","TreeView_element");
G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'MM_SyncItemsAll'),'All',external.LS('MM_SyncItemsAll'),0);
G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'USIS_SyncItemUnchanged'),'Unchanged',external.LS('USIS_SyncItemUnchanged'),0);
G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'USIS_SyncItemChanged'),'Changed',external.LS('USIS_SyncItemChanged'),0);
G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'USIS_SyncItemNew'),'New',external.LS('USIS_SyncItemNew'),0);
G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'USIS_SyncItemDeleted'),'Deleted',external.LS('USIS_SyncItemDeleted'),0);
G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'MM_UserMessagesInfo'),'Info',external.LS('MM_UserMessagesInfo'),0);
G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'MM_UserMessagesImportant'),'Important',external.LS('MM_UserMessagesImportant'),1);
AssociationElement = document.getElementById('Association_'+AssociationID);
AssociationElement.all['B_ANALYZE'].innerText = external.LS("button_analyze");
AssociationElement.all['B_ANALYZE'].title = external.LS("tooltip_Analyze_button");
AssociationElement.all['B_ANALYZE'].association_id = AssociationID;
AssociationElement.all['B_SYNC'].innerText = external.LS("button_synchronize");
AssociationElement.all['B_SYNC'].title = external.LS("tooltip_Sinchronize_button");
AssociationElement.all['B_SYNC'].association_id = AssociationID;
AssociationElement.all['B_STOP'].innerText = external.LS("button_stop");
AssociationElement.all['B_STOP'].title = external.LS("tooltip_Stop_button");
AssociationElement.all['B_STOP'].association_id = AssociationID;
AssociationElement.all['Important_warning_text'].innerText = external.LS("important_warning");
AssociationElement.all['Important_warning'].title = external.LS("tooltip_Important_warning");
}
function NewAssociation()
{
DeactivateAssociation(G_ActiveAssociationID);
solution = external.method0Own('M_GetSynchronizeProfileSolution');
Flag_can_reload_profile = false;
AssociationObj = solution.Method0('45001B2B2FE9B7A6F08366C1C15921A2'); //M_CreateAssociationW2Trees
// AssociationObj.Method1('45AB23FF99C4F08EFCD8EF9AFF1371B3', 'Association #'+G_LastAssociationNumber++); //M_SetAssociationName
Flag_can_reload_profile = true;
AddAssociation(AssociationObj);
ActivateAssociation(AssociationObj.objID);
//--- Other variant -------------
/* solution = external.method0Own('M_GetSynchronizeProfileSolution');
AssociationObj = solution.Method0('45001B2B2FE9B7A6F08366C1C15921A2'); //M_CreateAssociationW2Trees
RemoveAllAssociationsFromScreen();
G_ActiveAssociationID = AssociationObj.objID;
LoadProfile(); */
// ActivateAssociation(AssociationObj.objID);
}
function AddAssociation(AssociationObj)
{
if(TabsLabels.cells.length == 1)
{
LeftSeparatorCell = TabsLabels.insertCell(0);
LeftSeparatorCell.innerHTML = '<img src="Pics/TabCaptionPart3.gif">';
}
else
{
LeftSeparatorCell = TabsLabels.cells(TabsLabels.cells.length-2);
LeftSeparatorCell.children[0].src = 'Pics/TabCaptionPart7.gif';
}
NewLabelCell = TabsLabels.insertCell(TabsLabels.cells.length-1);
NewLabelCell.id = 'Label_'+AssociationObj.objID;
NewLabelCell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
NewLabelCell.style.cursor = "hand";
NewLabelCell.noWrap = true;
NewLabelCell.innerHTML = AssociationObj.Method0('443EF11F46C9207C2C595B7B21499882'); //M_GetAssociationName
NewLabelCell.onmousedown = TabLabelOnClick;
RightSeparatorCell = TabsLabels.insertCell(TabsLabels.cells.length-1);
RightSeparatorCell.innerHTML = '<img src="Pics/TabCaptionPart4.gif">';
TabsCaptionResized();
NewAssociationElement = document.createElement('div');
AssociationsContainer.appendChild(NewAssociationElement);
NewAssociationElement.outerHTML = '<div id="Association_'+AssociationObj.objID+'" style="position:absolute; width:100%; height:100%; visibility:hidden;">'+C_AssociationTemplate+'</div>'; //AssociationTemplate.innerHTML
// document.getElementById('Association_'+AssociationObj.objID).all['Id_of_current_association'].innerText = AssociationObj.objID;
InitAssociation(AssociationObj);
G_Associations[AssociationObj.objID].TreeView.redraw();
LoadAssociationPaths(AssociationObj.objID); // for DU: you can see many associations on the screen if comment this line
}
function ExtRemoveAssociation()
{
RemoveAssociation(G_ActiveAssociationID);
}
function RemoveAssociation(AssociationID)
{
var AssociationElement = document.getElementById('Association_'+AssociationID);
var AssociationsQuantity = (TabsLabels.cells.length-2)/2;
var LabelCell = TabsLabels.cells['Label_'+AssociationID];
var LabelCellIndex = LabelCell.cellIndex;
var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
var LastLabelIndex = TabsLabels.cells.length - 3;
var FirstLabelIndex = 1;
if(AssociationsQuantity > 1)
{
if(AssociationID == G_ActiveAssociationID)
{
DeactivateAssociation(G_ActiveAssociationID);
if(LabelCellIndex > FirstLabelIndex)
{
G_ActiveAssociationID = TabsLabels.cells(LabelCellIndex-2).id.replace(/Label_/,"");
}
else
{
G_ActiveAssociationID = TabsLabels.cells(LabelCellIndex+2).id.replace(/Label_/,"");
}
ActivateAssociation(G_ActiveAssociationID);
}
if((LabelCellIndex > FirstLabelIndex)&&(LabelCellIndex < LastLabelIndex))
{
var PrevAssociationID = TabsLabels.cells(LabelCellIndex-2).id.replace(/Label_/,"");
var NextAssociationID = TabsLabels.cells(LabelCellIndex+2).id.replace(/Label_/,"");
if(PrevAssociationID == G_ActiveAssociationID)
{
var SeparatorSrc = 'Pics/TabCaptionPart6.gif'; // Active/Unactive
}
else if(NextAssociationID == G_ActiveAssociationID)
{
var SeparatorSrc = 'Pics/TabCaptionPart5.gif'; // Unactive/Active
}
else
{
var SeparatorSrc = 'Pics/TabCaptionPart7.gif'; // Unactive/Unactive
}
}
else if(LabelCellIndex == FirstLabelIndex)
{
var NextAssociationID = TabsLabels.cells(LabelCellIndex+2).id.replace(/Label_/,"");
if(NextAssociationID == G_ActiveAssociationID)
{
var SeparatorSrc = 'Pics/TabCaptionPart1.gif'; // Empty/Active
}
else
{
var SeparatorSrc = 'Pics/TabCaptionPart3.gif'; // Empty/Unactive
}
}
else if(LabelCellIndex == LastLabelIndex)
{
var PrevAssociationID = TabsLabels.cells(LabelCellIndex-2).id.replace(/Label_/,"");
if(PrevAssociationID == G_ActiveAssociationID)
{
var SeparatorSrc = 'Pics/TabCaptionPart2.gif'; // Active/Empty
}
else
{
var SeparatorSrc = 'Pics/TabCaptionPart4.gif'; // Unactive/Empty
}
}
G_Associations[AssociationID] = null;
AssociationElement.removeNode(true);
TabsLabels.deleteCell(RightSeparatorCell.cellIndex);
TabsLabels.deleteCell(LabelCell.cellIndex);
LeftSeparatorCell.children(0).src = SeparatorSrc;
}
else // AssociationsQuantaty == 1
{
G_ActiveAssociationID = '';
G_Associations[AssociationID] = null;
AssociationElement.removeNode(true);
TabsLabels.deleteCell(RightSeparatorCell.cellIndex);
TabsLabels.deleteCell(LabelCell.cellIndex);
TabsLabels.deleteCell(LeftSeparatorCell.cellIndex);
}
TabsCaptionResized();
var AssociationObj = external.ObjByID(AssociationID);
var solution = external.method0Own('M_GetSynchronizeProfileSolution');
Flag_can_reload_profile = false;
solution.Method1('4462E413C9DCF8C259E8CA444BE8B2A7', AssociationObj); //M_RemoveProfileAssociation
Flag_can_reload_profile = true;
}
function RemoveAllAssociationsFromScreen()
{
// DeactivateAssociation(G_ActiveAssociationID);
var AssociationQuantity = AssociationsContainer.children.length;
/* if(G_ActiveAssociationID != '')
{
DeactivateAssociation(G_ActiveAssociationID);
} */ //Does not work correctly with {AssociationElement.removeNode(true)} in IE 5.01
for(var i=0; i<AssociationQuantity; i++)
{
var AssociationElement = AssociationsContainer.children(0);
var AssociationID = AssociationElement.id.replace(/Association_/,"");
// G_Associations[AssociationID] = null;
delete G_Associations[AssociationID];
AssociationElement.removeNode(true);
var LeftSeparatorCell = TabsLabels.cells(0);
var LabelCell = TabsLabels.cells(1);
TabsLabels.deleteCell(LeftSeparatorCell.cellIndex);
TabsLabels.deleteCell(LabelCell.cellIndex);
}
if(AssociationQuantity > 0)
{
var LastSeparatorCell = TabsLabels.cells(0);
TabsLabels.deleteCell(LastSeparatorCell.cellIndex);
}
TabsCaptionResized();
}
function DeactivateAssociation(AssociationID)
{
// ExtCloseHint(AssociationID, "Syncpath_hint_1");
// ExtCloseHint(AssociationID, "Syncpath_hint_2");
var AssociationElement = document.getElementById('Association_'+AssociationID);
if(AssociationElement == null)
{
return;
}
AssociationElement.style.visibility = 'hidden';
var LastLabelIndex = TabsLabels.cells.length - 3;
var FirstLabelIndex = 1;
var LabelCell = TabsLabels.cells['Label_'+AssociationID];
var LabelCellIndex = LabelCell.cellIndex;
var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
LabelCell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
if(LabelCellIndex != FirstLabelIndex)
{
LeftSeparatorCell.children(0).src = 'Pics/TabCaptionPart7.gif'; // Unactive/Unactive
}
else
{
LeftSeparatorCell.children(0).src = 'Pics/TabCaptionPart3.gif'; // Empty/Unactive
}
if(LabelCellIndex != LastLabelIndex)
{
RightSeparatorCell.children(0).src = 'Pics/TabCaptionPart7.gif'; // Unactive/Unactive
}
else
{
RightSeparatorCell.children(0).src = 'Pics/TabCaptionPart4.gif'; // Unactive/Empty
}
}
function ActivateAssociation(AssociationID)
{
var AssociationElement = document.getElementById('Association_'+AssociationID);
if(AssociationElement == null)
{
return;
}
AssociationElement.style.visibility = 'visible';
var LastLabelIndex = TabsLabels.cells.length - 3;
var FirstLabelIndex = 1;
var LabelCell = TabsLabels.cells['Label_'+AssociationID];
var LabelCellIndex = LabelCell.cellIndex;
var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
LabelCell.style.backgroundImage = "url('Pics/TabCaptionMid2.gif')";
if(LabelCellIndex != FirstLabelIndex)
{
LeftSeparatorCell.children(0).src = 'Pics/TabCaptionPart5.gif'; // Unactive/Active
}
else
{
LeftSeparatorCell.children(0).src = 'Pics/TabCaptionPart1.gif'; // Empty/Active
}
if(LabelCellIndex != LastLabelIndex)
{
RightSeparatorCell.children(0).src = 'Pics/TabCaptionPart6.gif'; // Active/Unactive
}
else
{
RightSeparatorCell.children(0).src = 'Pics/TabCaptionPart2.gif'; // Active/Empty
}
G_ActiveAssociationID = AssociationID;
ScrollTabLabelIntoView(AssociationID);
LoadAssociationPaths(AssociationID);
ExtUpdateButtons(AssociationID);
}
function ExtOnAssociationChanged(AssociationID)
{
if(Flag_can_reload_profile == false)
{
return;
}
var AssociationObj = external.ObjByID(AssociationID);
var LabelCell = TabsLabels.cells['Label_'+AssociationID];
LabelCell.innerText = AssociationObj.Method0('443EF11F46C9207C2C595B7B21499882'); //M_GetAssociationName;
G_Associations[AssociationID].OnAssociationChangedCalled = true;
if(LoadAssociationPaths(AssociationID) == true)
{
if(G_AnalyzeHintCallCounter > 0)
{
ExtGiveHint(AssociationID, "Analyze_hint");
G_AnalyzeHintCallCounter--;
}
if(AssociationID == G_ActiveAssociationID)
{
setTimeout("FocusToAnalyze('"+AssociationID+"')", 0);
}
}
}
function FocusToAnalyze(AssociationID)
{
if(AssociationID != G_ActiveAssociationID)
{
return;
}
AssociationElement = document.getElementById('Association_'+AssociationID);
AnalyzeButtonElement = AssociationElement.all['B_ANALYZE'];
if(AnalyzeButtonElement.disabled == false)
{
AnalyzeButtonElement.focus();
}
}
function FocusToSyncpath(AssociationID, num)
{
if(AssociationID != G_ActiveAssociationID)
{
return;
}
AssociationElement = document.getElementById('Association_'+AssociationID);
TreePathDiv = AssociationElement.all["TreePath"+num];
if(TreePathDiv.disabled == false)
{
ExtGiveHint(AssociationID, "Syncpath_hint_"+num);
TreePathDiv.children(0).focus();
}
}
function LoadAssociationPaths(AssociationID)
{
AssociationObj = external.ObjByID(AssociationID);
SyncTreeList = AssociationObj.GetM('CLASS_CSyncTree');
SyncTree1_Obj = SyncTreeList.GetFirst();
SyncTree2_Obj = SyncTreeList.GetNext(SyncTree1_Obj);
HintCalledNumber = "";
if(BuildFolderPanel(document.getElementById('Association_'+AssociationID).all['SyncTree2'], SyncTree2_Obj, 2) == false)
{
HintCalledNumber = "2";
G_Associations[AssociationID].Folder_2_is_ready = false;
}
else
{
G_Associations[AssociationID].Folder_2_is_ready = true;
}
if(BuildFolderPanel(document.getElementById('Association_'+AssociationID).all['SyncTree1'], SyncTree1_Obj, 1) == false)
{
HintCalledNumber = "1";
G_Associations[AssociationID].Folder_1_is_ready = false;
}
else
{
G_Associations[AssociationID].Folder_1_is_ready = true;
}
if(HintCalledNumber != "")
{
G_Associations[AssociationID].Folders_is_ready = false;
setTimeout("FocusToSyncpath('"+AssociationID+"', '"+HintCalledNumber+"')", 0);
return 0;
}
G_Associations[AssociationID].Folders_is_ready = true;
return true;
}
function BuildFolderPanel(SyncTreeElement, SyncTreeObject, FolderNum) // Returns true if tree is ready and false otherwise
{
SyncTreeElement.synctree_id=SyncTreeObject.objID;
if(SyncTreeObject.Method0('M_IsTreeReady') == 1)
{
SyncTree_path = SyncTreeObject.Method0Own('M_CreateTreeRootPath').Method0Own('M_ToFilename');
if_empty_flag = "false";
IfTreeReady = true;
}
else
{
SyncTree_path ="";
if_empty_flag = "true";
IfTreeReady = false;
}
SyncTreeElement.innerHTML = '<form id="TreeForm'+FolderNum+'" onSubmit="return ChangeSyncTree('+FolderNum+');" style="margin:0px;" title="'+external.LS("tooltip_sync_board_right")+'" ondeactivate="Deactivate_form('+FolderNum+')" is_changed="false" is_empty="'+if_empty_flag+'">'+
'<table width="100%" cellspacing="0"><tr><td colspan="3" width="100%" height="22px;"><div style="position:relative; top:0px; left:0px; height:22px;">'+
'<div id="TreePath'+FolderNum+'" style="position:absolute; top:0px; left:0px; width:296px; height:25px;">'+
'<input id="'+SyncTreeObject.objID+'_path" type="text" value="'+SyncTree_path+'" style="width:100%; border: solid 1px black; background:#f6f6f6; font-family:tahoma; font-size:10pt;" onkeyup="Ok_Activate('+FolderNum+')" onactivate="Activate_form('+FolderNum+')"></div></div>'+
'</td></tr><tr><td nowrap>'+
'<input name="TreeOpen'+FolderNum+'" type="button" value="'+external.LS("button_open")+'" onclick=OpenSyncTree('+FolderNum+') style="width:60px; font-size:10px; " title="'+external.LS("tooltip_FSP_Open")+'">'+
'<input name="TreeBrowse'+FolderNum+'" type="button" value="'+external.LS("button_browse")+'" onclick=BrowseSyncTree('+FolderNum+') style="width:60px; font-size:10px; " title="'+external.LS("tooltip_FSP_Browse")+'">'+
'</td><td width="100%"></td><td id="TreeSubmitButtons'+FolderNum+'" nowrap>'+
'<input name="TreeOk'+FolderNum+'" type="submit" value="'+external.LS("button_ok")+'" style="width:60px; font-size:10px; " disabled tabIndex="0" title="'+external.LS("tooltip_FSP_Ok")+'">'+
'<input name="TreeCancel'+FolderNum+'" type="button" value="'+external.LS("button_cancel")+'" onclick=CancelSyncTree('+FolderNum+') style="width:60px; font-size:10px;" disabled tabIndex="0" title="'+external.LS("tooltip_FSP_Cancel")+'">'+
'</td></tr></table>'+
'</form>';
return IfTreeReady;
}
function OnCollectionExpandIconClick(AssociationID, CollectionID)
{
G_Associations[AssociationID].TreeView.click(CollectionID);
}
function go_prev_page(CollectionID)
{
control_element = window.event.srcElement;
ScrollControlDown(control_element);
AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
collection_container = AssociationElement.all[CollectionID+'_container'];
if(collection_container == null)
{
return;
}
msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
list_length = collection_container.children.length;
if(msgs.GetFirst().objID == G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg)
{
RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, true);
return;
}
for(i=0; i<list_length; i++)
{
msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null); //MM_FlagNotifyScript to null
}
msg = msgs.ObjByID(G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg);
i=C_MESSAGES_ON_PAGE; //G_Associations[AssociationID].TreeView._messagesonpage;
MsgEvenness = G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
while((i>0)&&(msg.objID != msgs.GetFirst().objID))
{
MsgEvenness = 1 - MsgEvenness;
i--;
msg = msgs.GetPrev(msg);
}
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = msg.objID;
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = MsgEvenness;
G_Associations[G_ActiveAssociationID].TreeView.redraw_collection(CollectionID);
}
function go_next_page(CollectionID)
{
control_element = window.event.srcElement;
ScrollControlDown(control_element);
AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
collection_container = AssociationElement.all[CollectionID+'_container'];
if(collection_container == null)
{
return;
}
msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
list_length = collection_container.children.length;
last_in_list = collection_container.children(list_length-1);
if(msgs.GetLast().objID == last_in_list.id)
{
if(msgs.GetFirst().objID == collection_container.children(0).id)
{
var MsgScrollersExist = false;
RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, MsgScrollersExist);
RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, MsgScrollersExist);
}
else
{
var MsgScrollersExist = true;
RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, MsgScrollersExist);
}
AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
return;
}
for(i=0; i<list_length; i++)
{
msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null); //MM_FlagNotifyScript to null
}
var msg = msgs.GetNext(msgs.ObjByID(last_in_list.id));
var i = C_MESSAGES_ON_PAGE;
while((i>0)&&(msg.objID != msgs.GetLast().objID))
{
i--;
msg = msgs.GetNext(msg);
}
if(i > 0)
{
go_last_page(CollectionID);
}
else
{
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = msgs.GetNext(msgs.ObjByID(last_in_list.id)).objID;
MsgEvenness = G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = (MsgEvenness+list_length)%2;
G_Associations[G_ActiveAssociationID].TreeView.redraw_collection(CollectionID);
}
}
function go_next_message(CollectionID)
{
control_element = window.event.srcElement;
ScrollControlDown(control_element);
var AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
var collection_container = AssociationElement.all[CollectionID+'_container'];
if(collection_container == null)
{
return;
}
var msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
var list_length = collection_container.children.length;
var last_in_list = collection_container.children(list_length-1);
var AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
if(msgs.GetLast().objID == last_in_list.id)
{
// var collection_next = AssociationElement.all[CollectionID+'_next'];
// collection_next.innerHTML = CreateScrollControls("next", false, CollectionID);
RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, true);
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
return;
}
var first_in_list = collection_container.children(0);
msgs.ObjByID(first_in_list.id).SetM(CollectionID, null); //MM_FlagNotifyScript to null
//G_Associations[AssociationID].TreeView.root._children[CollectionID]._first_disp_msg = collection_container.children(1).id;
var new_on_page_last_msg_id = msgs.GetNext(msgs.ObjByID(last_in_list.id)).objID;
first_in_list.removeNode(true); // Delete the element and all it's children
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = collection_container.children(0).id;
MsgEvenness = G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = 1 - MsgEvenness;
var new_last_message_element = document.createElement('tbody');
collection_container.appendChild(new_last_message_element);
BuildMessageAsObject(new_last_message_element, CollectionID, new_on_page_last_msg_id, (MsgEvenness+list_length)%2);
if(new_on_page_last_msg_id == msgs.GetLast().objID) //New message on page is last in collection, then remove "Next" control
{
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
// var collection_next = AssociationElement.all[CollectionID+'_next'];
// collection_next.innerHTML = CreateScrollControls("next", false, CollectionID);
RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, true);
}
// var collection_prev = AssociationElement.all[CollectionID+'_prev'];
// collection_prev.innerHTML = CreateScrollControls("prev", true, CollectionID);
RefreshMsgScrollers(AssociationElement, "prev", true, CollectionID, true);
}
function go_prev_message(CollectionID)
{
// alert('go_prev_message pressed');
control_element = window.event.srcElement;
ScrollControlDown(control_element);
AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
collection_container = AssociationElement.all[CollectionID+'_container'];
if(collection_container == null)
{
return;
}
msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
list_length = collection_container.children.length;
// alert(list_length);
// alert(msgs.GetFirst().objID+' == '+G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg);
if(msgs.GetFirst().objID == G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg)
{
// collection_prev = AssociationElement.all[CollectionID+'_prev'];
// collection_prev.innerHTML = CreateScrollControls("prev", false, CollectionID);
RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, true);
return;
}
if(list_length == C_MESSAGES_ON_PAGE) //G_Associations[AssociationID].TreeView._messagesonpage)
{
last_in_list = collection_container.children(list_length-1);
msgs.ObjByID(last_in_list.id).SetM(CollectionID, null); //MM_FlagNotifyScript to null
last_in_list.removeNode(true); // Delete the element and all it's children
AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
AdditionalAttributes.SetM('MM_FlagNotifyScript', false);
// collection_next = AssociationElement.all[CollectionID+'_next'];
// collection_next.innerHTML = CreateScrollControls("next", true, CollectionID);
RefreshMsgScrollers(AssociationElement, "next", true, CollectionID, true);
}
first_in_list = collection_container.children(0);
new_on_page_first_msg_id = msgs.GetPrev(msgs.ObjByID(first_in_list.id)).objID;
var new_first_message_element = document.createElement('tbody');
collection_container.insertBefore(new_first_message_element, first_in_list);
var NewFirstMsgEvenness = (G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness+1)%2;
BuildMessageAsObject(new_first_message_element, CollectionID, new_on_page_first_msg_id, NewFirstMsgEvenness);
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = NewFirstMsgEvenness;
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = collection_container.children(0).id;
if(msgs.GetFirst().objID == G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg)
{
// collection_prev = AssociationElement.all[CollectionID+'_prev'];
// collection_prev.innerHTML = CreateScrollControls("prev", false, CollectionID);
RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, true);
}
return;
}
function go_first_page(CollectionID)
{
AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
collection_container = AssociationElement.all[CollectionID+'_container'];
if(collection_container == null)
{
return;
}
msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
list_length = collection_container.children.length;
first_msg_id = msgs.GetFirst().objID;
if(first_msg_id == G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg)
{
// collection_prev = AssociationElement.all[CollectionID+'_prev'];
// collection_prev.innerHTML = CreateScrollControls("prev", false, CollectionID);
RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, true);
return;
}
for(i=0; i<list_length; i++)
{
msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null); //MM_FlagNotifyScript to null
}
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = first_msg_id;
G_Associations[G_ActiveAssociationID].TreeView.redraw_collection(CollectionID);
}
function go_last_page(CollectionID)
{
AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
collection_container = AssociationElement.all[CollectionID+'_container'];
if(collection_container == null)
{
return;
}
msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
list_length = collection_container.children.length;
msg = msgs.GetLast();
last_in_list = collection_container.children(list_length-1);
if(msg.objID == last_in_list.id)
{
// collection_next = AssociationElement.all[CollectionID+'_next'];
// collection_next.innerHTML = CreateScrollControls("next", false, CollectionID);
RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, true);
AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
return;
}
for(i=0; i<list_length; i++)
{
msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null); //MM_FlagNotifyScript to null
}
i=C_MESSAGES_ON_PAGE - 1; //G_Associations[AssociationID].TreeView._messagesonpage-1;
while((i>0)&&(msg.objID != msgs.GetFirst().objID))
{
i--;
msg = msgs.GetPrev(msg);
}
G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = msg.objID;
G_Associations[G_ActiveAssociationID].TreeView.redraw_collection(CollectionID);
}
function CreateScrollControls(direction, if_active, CollectionID, MsgScrollersExist)
{
if(!MsgScrollersExist)
{
this.msg = '';
this.page = '';
this.end = '';
this.top_msg = '';
this.top_page = '';
this.top_end = '';
return this;
}
if(direction == 'next')
{
dir1 = 'next';
dir2 = 'Next';
dir3 = 'last';
dir4 = 'Last';
var v_border = 'border-right:solid 1px #787864;';
}
else
{
dir1 = 'prev';
dir2 = 'Prev';
dir3 = 'first';
dir4 = 'First';
var v_border = 'border-left:solid 1px #787864;';
}
var border_style = 'style="border-top:solid 1px #787864; border-bottom:solid 1px #787864;"';
var border_style_brink = 'style="border-top:solid 1px #787864; border-bottom:solid 1px #787864; '+v_border+'"';
if(if_active == true)
{
this.msg = '<img onmousedown="go_'+dir1+'_message(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" onmouseup="ScrollControlUp()" src="Pics/'+dir2+'Message.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_message")+'">';
this.page = '<img onmousedown="go_'+dir1+'_page(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" src="Pics/'+dir2+'Page.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_page")+'">';
this.end = '<img onmousedown="go_'+dir3+'_page(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" src="Pics/To'+dir4+'.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir3+"_page")+'">';
this.top_msg = '<img onmousedown="go_'+dir1+'_message(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" onmouseup="ScrollControlUp()" src="Pics/'+dir2+'Message.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_message")+'" '+border_style+'>';
this.top_page = '<img onmousedown="go_'+dir1+'_page(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" src="Pics/'+dir2+'Page.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_page")+'" '+border_style+'>';
this.top_end = '<img onmousedown="go_'+dir3+'_page(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" src="Pics/To'+dir4+'.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir3+"_page")+'" '+border_style_brink+'>';
}
else
{
this.msg = '<img src="Pics/'+dir2+'Message_gray.gif" >';
this.page = '<img src="Pics/'+dir2+'Page_gray.gif" >';
this.end = '<img src="Pics/To'+dir4+'_gray.gif">';
this.top_msg = '<img src="Pics/'+dir2+'Message_gray.gif" '+border_style+'>';
this.top_page = '<img src="Pics/'+dir2+'Page_gray.gif" '+border_style+'>';
this.top_end = '<img src="Pics/To'+dir4+'_gray.gif" '+border_style_brink+'>';
}
return this;
}
function RefreshMsgScrollers(AssociationElement, direction, if_active, CollectionID, MsgScrollersExist)
{
var collection_scrollbar = AssociationElement.all[CollectionID+'_ScrollBar'];
var collection_top_scrollbar = AssociationElement.all[CollectionID+'_in'];
// var MsgScrollersExist = true; //Debug line
Scroll_controls = new CreateScrollControls(direction, if_active, CollectionID, MsgScrollersExist);
if(direction == 'next')
{
dir2 = 'Next';
}
else
{
dir2 = 'Prev';
}
collection_scrollbar.all[dir2+'_msg'].innerHTML = Scroll_controls.msg;
collection_scrollbar.all[dir2+'_page'].innerHTML = Scroll_controls.page;
collection_scrollbar.all[dir2+'_end'].innerHTML = Scroll_controls.end;
collection_top_scrollbar.all['Top'+dir2+'_msg'].innerHTML = Scroll_controls.top_msg;
collection_top_scrollbar.all['Top'+dir2+'_page'].innerHTML = Scroll_controls.top_page;
collection_top_scrollbar.all['Top'+dir2+'_end'].innerHTML = Scroll_controls.top_end;
}
function ScrollControlHi()
{
control_element = window.event.srcElement;
control_src = control_element.src;
if(control_src == null)
{
return;
}
control_element.src = control_src.replace(/.gif/,"_hi.gif");
}
function ScrollControlUsual()
{
control_element = window.event.srcElement;
control_src = control_element.src;
if(control_src == null)
{
return;
}
control_element.src = control_src.replace(/(_hi)?.gif/,".gif");
}
function ScrollControlUp()
{
control_element = window.event.srcElement;
control_src = control_element.src;
if(control_src == null)
{
return;
}
control_element.src = control_src.replace(/(_hi)?.gif/,"_hi.gif");
}
function ScrollControlDown(control_element)
{
if(control_element == null)
{
// alert('control_element == null');
return;
}
if(control_element.tagName != 'IMG')
{
// alert('control_element.tagName == '+control_element.tagName);
return;
}
control_src = control_element.src; // Error 1152 occurred at 1-5-2
if(control_src == null)
{
// alert('control_src == null');
return;
}
// alert('control_src == '+control_src);
control_element.src = control_src.replace(/(_hi)?.gif/,".gif");
}
function CountersRefreshAtTimes()
{
ActiveAssociationObj = external.ObjByID(G_ActiveAssociationID);
ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['All']);
ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Unchanged']);
ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Changed']);
ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['New']);
ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Deleted']);
ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Info']);
ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Important']);
if(G_CounterRefreshFlag == true)
{
window.setTimeout("CountersRefreshAtTimes()",1000);
}
}
function ExtCounterRefresh(AssociationID, CollectionID)
{
AssociationElement = document.getElementById('Association_'+AssociationID);
if(AssociationElement == null)
{
return;
}
collection_caption_element = AssociationElement.all[CollectionID+'_caption'];
if(collection_caption_element != null)
{
collectionObj = G_Associations[AssociationID].TreeView._collections[CollectionID].obj;
CollectionChildrenCount = collectionObj.Method0('M_GetCount');
if(CollectionChildrenCount > 0)
{
collection_caption_element.innerHTML = CollectionChildrenCount;
}
else
{
G_Associations[AssociationID].TreeView.redraw_collection(CollectionID);
}
}
}
function FillMsgNode(MsgObj, MsgEvenness)
{
// MsgEvenness = 1;// Debug line, change later
if(MsgEvenness == 0)
{
var TbodyClass = "Msg_Even";
}
else
{
var TbodyClass = "Msg_Odd";
}
if(MsgObj.IsSyncItemMsg())
{
solution = MsgObj.GetObjM('MM_Solution');
if(solution == null)
{
alert("solution == null");
return "";
}
var AssociationObj = MsgObj.GetM('CLASS_CSolutionDoAssociationSync');
var SyncTreeList = AssociationObj.GetM('CLASS_CSyncTree');
var SyncTree1_Obj = SyncTreeList.GetFirst();
var SyncTree2_Obj = SyncTreeList.GetNext(SyncTree1_Obj);
var SyncTreeId_1 = SyncTree1_Obj.GetM('MM_TreeID');
var SyncTreeId_2 = SyncTree2_Obj.GetM('MM_TreeID');
var WinningTreeID = solution.GetM('MM_WinningTreeID');
var SolutionActionState = solution.GetM('MM_ActionState');
var WinningArrow = "Attention!!!";
var MoreMarker = "X";
var file1_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_1);
var file2_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_2);
LeftSyncItemCharacteristics = new CreateSyncItemCharacteristics(solution,SyncTreeId_1);
RightSyncItemCharacteristics = new CreateSyncItemCharacteristics(solution,SyncTreeId_2);
if((SolutionActionState == null)||(SolutionActionState == C_ACTION_STATE_INIT)) //ACTION_STATE_INIT
{
if (WinningTreeID == SyncTreeId_1)
{
tooltip_1 = external.LS("tooltip_copy")+' '+file1_name+' '+external.LS("tooltip_to")+' '+file2_name;
tooltip_2 = external.LS("tooltip_more_alt");
if(LeftSyncItemCharacteristics.if_missing != true)
{
WinningArrow='<img src="Pics/Arrow1.gif" title="'+tooltip_1+'">';
}
else
{
WinningArrow='<img src="Pics/Arrow1_del.gif" title="'+tooltip_1+'">';
}
MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">'; //+external.LS("tooltip_more_alt")+
}
else if (WinningTreeID == SyncTreeId_2)
{
tooltip_1 = external.LS("tooltip_copy")+' '+file2_name+' '+external.LS("tooltip_to")+' '+file1_name;
tooltip_2 = external.LS("tooltip_more_alt");
if(RightSyncItemCharacteristics.if_missing != true)
{
WinningArrow='<img src="Pics/Arrow2.gif" title="'+tooltip_1+'">';
}
else
{
WinningArrow='<img src="Pics/Arrow2_del.gif" title="'+tooltip_1+'">';
}
MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">';
}
else if (WinningTreeID == C_CID) //CID
{
tooltip_1 = external.LS("tooltip_CID_arrow");
tooltip_2 = external.LS("tooltip_more_alt");
WinningArrow='<img src="Pics/Arrow3.gif" title="'+tooltip_1+'">';
MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">';
}
}
else if(SolutionActionState == C_ACTION_STATE_IN_PROGRESS) //ACTION_STATE_IN_PROGRESS
{
if (WinningTreeID == SyncTreeId_1)
{
WinningArrow='<img src="Pics/Arrow1_progressed.gif" title="'+external.LS("tooltip_action_in_progress")+'">';
MoreMarker = '<img src="Pics/More.gif">';
}
else if (WinningTreeID == SyncTreeId_2)
{
WinningArrow='<img src="Pics/Arrow2_progressed.gif" title="'+external.LS("tooltip_action_in_progress")+'">';
MoreMarker = '<img src="Pics/More.gif">';
}
else if (WinningTreeID == C_CID) //CID
{
tooltip_1 = external.LS("tooltip_CID_arrow");
WinningArrow='<img src="Pics/Arrow3.gif" title="'+tooltip_1+'">';
MoreMarker = '<img src="Pics/More.gif">';
}
}
else if(SolutionActionState == C_ACTION_STATE_DONE) //ACTION_STATE_DONE
{
if (WinningTreeID == SyncTreeId_1)
{
tooltip_1 = external.LS("tooltip_action_done");
if(LeftSyncItemCharacteristics.if_missing != true)
{
WinningArrow='<img src="Pics/Arrow1_gray.gif" title="'+tooltip_1+'">';
}
else
{
WinningArrow='<img src="Pics/Arrow1_del_gray.gif" title="'+tooltip_1+'">';
}
// WinningArrow='<img src="Pics/Arrow1_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
MoreMarker = '<img src="Pics/More_ok.gif">';
}
else if (WinningTreeID == SyncTreeId_2)
{
tooltip_1 = external.LS("tooltip_action_done");
if(RightSyncItemCharacteristics.if_missing != true)
{
WinningArrow='<img src="Pics/Arrow2_gray.gif" title="'+tooltip_1+'">';
}
else
{
WinningArrow='<img src="Pics/Arrow2_del_gray.gif" title="'+tooltip_1+'">';
}
// WinningArrow='<img src="Pics/Arrow2_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
MoreMarker = '<img src="Pics/More_ok.gif">';
}
else if (WinningTreeID == C_CID) //CID
{
WinningArrow='<img src="Pics/Arrow3_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
MoreMarker = '<img src="Pics/More_ok.gif">';
}
}
Severity = MsgObj.Method0('M_GetStackSeverity');
Alternatives_Arrows = "";
/*if((Severity >= C_ERR_QUESTION)&&((SolutionActionState == null)||(SolutionActionState == C_ACTION_STATE_INIT))) // C_ERR_QUESTION = 6000
{
Alternatives_Arrows = MakeAltArrows(AssociationObj, solution);
tooltip_2 = external.LS("tooltip_hide_alt");
AltButtonsClass = 'AltButtonsExpanded';
MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+
MsgObj.objID+'" onclick=HideAltArrows() src="Pics/More_up.gif" title="'+tooltip_2+'">';
}
else*/
{
AltButtonsClass = 'AltButtonsCollapsed';
Alternatives_Arrows = "";
}
/*--------------------------------------------------------------------------------------------
<tbody class="Msg_Odd">
<tr>
<td width="50%" class="SyncAttribute" rowspan="2">c:\tete<wbr>\ert<wbr>\oifoio<wbr>\1<wbr>\file1.txt</td>
<td class="SyncAttribute" rowspan="2">1234</td>
<td nowrap class="SyncAttribute" rowspan="2">13.10.2004 11:23</td>
<td class="Arrow"><img src="Pics/Arrow1.gif"></td><td class="MoreArrow"><img src="Pics/More.gif"></td>
<td width="50%" class="SyncAttribute" rowspan="2">c:\tete<wbr>\1<wbr>\file1.txt</td>
<td class="SyncAttribute" rowspan="2">1234</td>
<td nowrap class="SyncAttribute" rowspan="2">13.10.2004 11:23</td>
</tr>
<tr>
<td class="AltButtonsExpanded" colspan="2" nowrap>
<img src="Pics/Arrow2_small_but.gif" style="position:relative; left:1px; top:2px;"><img src="Pics/Arrow1_small_but.gif" style="position:relative; left:2px; top:2px;"><img src="Pics/Arrow3_small_but.gif" style="position:relative; left:3px; top:2px;">
</td>
</tr>
</tbody>
*/ //--------------------------------------------------------------------------------------------
if(LeftSyncItemCharacteristics.state == '')
{
LeftSyncItemCharacteristics_html = '<td width="50%" class="SyncAttrName" rowspan="2">'+
LeftSyncItemCharacteristics.name+'</td>'+
'<td title="'+external.LS("tooltip_file_size")+'" class="SyncAttribute" rowspan="2">'+
'<span style="width:40px">'+LeftSyncItemCharacteristics.size+'</span>'+
'</td><td nowrap class="SyncAttribute" title="'+external.LS("tooltip_file_time")+'" rowspan="2">'+
'<span style="width:90px">'+LeftSyncItemCharacteristics.time+'</span></td>';
}
else
{
if(LeftSyncItemCharacteristics.if_missing == true)
{
var State_style = 'style="color:red"';
}
else
{
var State_style = '';
}
LeftSyncItemCharacteristics_html = '<td width="50%" class="SyncAttrName" rowspan="2">'+
LeftSyncItemCharacteristics.name+'</td>'+
'<td class="SyncAttrState" colspan="2" valign="middle" align="center" nowrap '+State_style+' rowspan="2">'+
'<span style="width:135px">'+LeftSyncItemCharacteristics.state+'</span></td>';
}
if(RightSyncItemCharacteristics.state == '')
{
RightSyncItemCharacteristics_html = '<td width="50%" class="SyncAttrName" rowspan="2">'+
RightSyncItemCharacteristics.name+'</td>'+
'<td class="SyncAttribute" title="'+external.LS("tooltip_file_size")+'" rowspan="2">'+
'<span style="width:40px">'+RightSyncItemCharacteristics.size+'</span></td>'+
'<td class="SyncAttribute" nowrap title="'+external.LS("tooltip_file_time")+'" rowspan="2">'+
'<span style="width:90px">'+RightSyncItemCharacteristics.time+'</span></td>';
}
else
{
if(RightSyncItemCharacteristics.if_missing == true)
{
State_style = 'style="color:red"';
}
else
{
var State_style = '';
}
RightSyncItemCharacteristics_html = '<td width="50%" class="SyncAttrName" rowspan="2">'+
RightSyncItemCharacteristics.name+'</td>'+
'<td class="SyncAttrState" colspan="2" valign="middle" align="center" nowrap '+State_style+'" rowspan="2">'+
'<span style="width:135px">'+RightSyncItemCharacteristics.state+'</span></td>';
}
msg_html = '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'"><tr>'+LeftSyncItemCharacteristics_html+
'<td class="Arrow" valign="top">'+WinningArrow+'</td><td class="MoreArrow" valign="top">'+MoreMarker+'</td>'+RightSyncItemCharacteristics_html+
'</tr><tr>'+
'<td id="AlternativesArrows" class="'+AltButtonsClass+'" colspan="2" nowrap>'+Alternatives_Arrows+'</td></tr></tbody>';
return msg_html;
}
else // Message is not sync item
{
msg_html = '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'"><tr>'+
'<td colspan="8" class="info_msg">'+ MsgObj.ToString()+CreateMsgButtons(MsgObj)+'</td></tr></tbody>';
return msg_html;
};
}
function BuildMessageAsObject(message_tbody_element, CollectionID, MessageID, MsgEvenness)
{
// MsgEvenness = 1;// Debug line, change later
if(MsgEvenness == 0)
{
TbodyClass = "Msg_Even";
}
else
{
TbodyClass = "Msg_Odd";
}
var MsgObj = external.ObjByID(MessageID);
MsgObj.SetM(CollectionID, 1); //MM_FlagNotifyScript to 1
var AssociationObj = MsgObj.GetM('CLASS_CSolutionDoAssociationSync');
var AssociationID = AssociationObj.objID;
message_tbody_element.id = MessageID;
message_tbody_element.className = TbodyClass;
var tbody_length = message_tbody_element.rows.length;
for(i=0; i<tbody_length; i++)
{
message_tbody_element.deleteRow();
}
var main_line_element = message_tbody_element.insertRow();
if(MsgObj.IsSyncItemMsg())
{
var solution = MsgObj.GetObjM('MM_Solution');
if(solution == null)
{
alert("solution == null");
return "";
}
var SyncTreeList = AssociationObj.GetM('CLASS_CSyncTree');
var SyncTree1_Obj = SyncTreeList.GetFirst();
var SyncTree2_Obj = SyncTreeList.GetNext(SyncTree1_Obj);
var SyncTreeId_1 = SyncTree1_Obj.GetM('MM_TreeID');
var SyncTreeId_2 = SyncTree2_Obj.GetM('MM_TreeID');
var WinningTreeID = solution.GetM('MM_WinningTreeID');
var SolutionActionState = solution.GetM('MM_ActionState');
var WinningArrow = "Attention!!!";
var MoreMarker = "X";
// alert('SyncTreeId_1 == '+SyncTreeId_1);
var file1_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_1);
// alert('file1_name == '+file1_name);
// alert('SyncTreeId_2 == '+SyncTreeId_2);
var file2_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_2);
// alert('file2_name == '+file2_name);
LeftSyncItemCharacteristics = new CreateSyncItemCharacteristics(solution,SyncTreeId_1);
RightSyncItemCharacteristics = new CreateSyncItemCharacteristics(solution,SyncTreeId_2);
if((SolutionActionState == null)||(SolutionActionState == C_ACTION_STATE_INIT)) //ACTION_STATE_INIT
{
if (WinningTreeID == SyncTreeId_1)
{
tooltip_1 = external.LS("tooltip_copy")+' '+file1_name+' '+external.LS("tooltip_to")+' '+file2_name;
tooltip_2 = external.LS("tooltip_more_alt");
if(LeftSyncItemCharacteristics.if_missing != true)
{
WinningArrow='<img src="Pics/Arrow1.gif" title="'+tooltip_1+'">';
}
else
{
WinningArrow='<img src="Pics/Arrow1_del.gif" title="'+tooltip_1+'">';
}
MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">'; //+external.LS("tooltip_more_alt")+
}
else if (WinningTreeID == SyncTreeId_2)
{
tooltip_1 = external.LS("tooltip_copy")+' '+file2_name+' '+external.LS("tooltip_to")+' '+file1_name;
tooltip_2 = external.LS("tooltip_more_alt");
if(RightSyncItemCharacteristics.if_missing != true)
{
WinningArrow='<img src="Pics/Arrow2.gif" title="'+tooltip_1+'">';
}
else
{
WinningArrow='<img src="Pics/Arrow2_del.gif" title="'+tooltip_1+'">';
}
MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">';
}
else if (WinningTreeID == C_CID) //CID
{
tooltip_1 = external.LS("tooltip_CID_arrow");
tooltip_2 = external.LS("tooltip_more_alt");
WinningArrow='<img src="Pics/Arrow3.gif" title="'+tooltip_1+'">';
MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">';
}
}
else if(SolutionActionState == C_ACTION_STATE_IN_PROGRESS) //ACTION_STATE_IN_PROGRESS
{
if (WinningTreeID == SyncTreeId_1)
{
WinningArrow='<img src="Pics/Arrow1_progressed.gif" title="'+external.LS("tooltip_action_in_progress")+'">';
MoreMarker = '<img src="Pics/More.gif">';
}
else if (WinningTreeID == SyncTreeId_2)
{
WinningArrow='<img src="Pics/Arrow2_progressed.gif" title="'+external.LS("tooltip_action_in_progress")+'">';
MoreMarker = '<img src="Pics/More.gif">';
}
else if (WinningTreeID == C_CID) //CID
{
tooltip_1 = external.LS("tooltip_CID_arrow");
WinningArrow='<img src="Pics/Arrow3.gif" title="'+tooltip_1+'">';
MoreMarker = '<img src="Pics/More.gif">';
}
}
else if(SolutionActionState == C_ACTION_STATE_DONE) //ACTION_STATE_DONE
{
if (WinningTreeID == SyncTreeId_1)
{
tooltip_1 = external.LS("tooltip_action_done");
if(LeftSyncItemCharacteristics.if_missing != true)
{
WinningArrow='<img src="Pics/Arrow1_gray.gif" title="'+tooltip_1+'">';
}
else
{
WinningArrow='<img src="Pics/Arrow1_del_gray.gif" title="'+tooltip_1+'">';
}
// WinningArrow='<img src="Pics/Arrow1_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
MoreMarker = '<img src="Pics/More_ok.gif">';
}
else if (WinningTreeID == SyncTreeId_2)
{
tooltip_1 = external.LS("tooltip_action_done");
if(RightSyncItemCharacteristics.if_missing != true)
{
WinningArrow='<img src="Pics/Arrow2_gray.gif" title="'+tooltip_1+'">';
}
else
{
WinningArrow='<img src="Pics/Arrow2_del_gray.gif" title="'+tooltip_1+'">';
}
// WinningArrow='<img src="Pics/Arrow2_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
MoreMarker = '<img src="Pics/More_ok.gif">';
}
else if (WinningTreeID == C_CID) //CID
{
WinningArrow='<img src="Pics/Arrow3_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
MoreMarker = '<img src="Pics/More_ok.gif">';
}
}
Severity = MsgObj.Method0('M_GetStackSeverity');
/*if((Severity >= C_ERR_QUESTION)&&((SolutionActionState == null)||(SolutionActionState == C_ACTION_STATE_INIT))) // C_ERR_QUESTION = 6000
{
Alternatives_Arrows = MakeAltArrows(AssociationObj, solution);
AltArrowsClass = "AltButtonsExpanded";
tooltip_2 = external.LS("tooltip_hide_alt");
MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+
MsgObj.objID+'" onclick=HideAltArrows() src="Pics/More_up.gif" title="'+tooltip_2+'">';
}
else*/
{
Alternatives_Arrows = '';
AltArrowsClass = "AltButtonsCollapsed";
}
if(LeftSyncItemCharacteristics.state == '')
{
name_element = main_line_element.insertCell();
name_element.width="50%";
name_element.className="SyncAttrName";
name_element.rowSpan = "2";
name_element.innerHTML = LeftSyncItemCharacteristics.name;
size_element = main_line_element.insertCell();
size_element.className="SyncAttribute";
size_element.rowSpan = "2";
size_element.title = external.LS("tooltip_file_size");
size_element.innerHTML = '<span style="width:40px">'+LeftSyncItemCharacteristics.size+'</span>';
time_element = main_line_element.insertCell();
time_element.className="SyncAttribute";
time_element.rowSpan = "2";
time_element.noWrap = true;
time_element.title = external.LS("tooltip_file_time");
time_element.innerHTML = '<span style="width:90px">'+LeftSyncItemCharacteristics.time+'</span>';
}
else
{
name_element = main_line_element.insertCell();
name_element.className="SyncAttrName";
name_element.rowSpan = "2";
name_element.width="50%";
name_element.innerHTML = LeftSyncItemCharacteristics.name;
state_element = main_line_element.insertCell();
state_element.className="SyncAttrState";
state_element.rowSpan = "2";
state_element.colSpan="2";
state_element.align="center";
state_element.noWrap=true;
if(LeftSyncItemCharacteristics.if_missing == true)
{
state_element.style.color="red";
}
state_element.innerHTML = '<span style="width:135px">'+LeftSyncItemCharacteristics.state+'</span>';
}
WinningArrow_element = main_line_element.insertCell();
WinningArrow_element.className = "Arrow";
WinningArrow_element.vAlign = "top";
WinningArrow_element.innerHTML = WinningArrow;
MoreMarker_element = main_line_element.insertCell();
MoreMarker_element.className="MoreArrow";
MoreMarker_element.vAlign = "top";
MoreMarker_element.innerHTML = MoreMarker;
if(RightSyncItemCharacteristics.state == '')
{
name_element = main_line_element.insertCell();
name_element.width="50%";
name_element.className="SyncAttrName";
name_element.rowSpan = "2";
name_element.innerHTML = RightSyncItemCharacteristics.name;
size_element = main_line_element.insertCell();
size_element.className="SyncAttribute";
size_element.rowSpan = "2";
size_element.title = external.LS("tooltip_file_size");
size_element.innerHTML = '<span style="width:40px">'+RightSyncItemCharacteristics.size+'</span>';
time_element = main_line_element.insertCell();
time_element.className="SyncAttribute";
time_element.rowSpan = "2";
time_element.noWrap = true;
time_element.title = external.LS("tooltip_file_time");
time_element.innerHTML = '<span style="width:90px">'+RightSyncItemCharacteristics.time+'</span>';
}
else
{
name_element = main_line_element.insertCell();
name_element.className="SyncAttrName";
name_element.rowSpan = "2";
name_element.width="50%";
name_element.innerHTML = RightSyncItemCharacteristics.name;
state_element = main_line_element.insertCell();
state_element.className="SyncAttrState";
state_element.rowSpan = "2";
state_element.colSpan="2";
state_element.align="center";
state_element.noWrap=true;
if(RightSyncItemCharacteristics.if_missing == true)
{
state_element.style.color="red";
}
state_element.innerHTML = '<span style="width:135px">'+RightSyncItemCharacteristics.state+'</span>';
}
addline_element = message_tbody_element.insertRow();
addline_cell_element = addline_element.insertCell();
addline_cell_element.id ="AlternativesArrows";
addline_cell_element.colSpan="2";
addline_cell_element.className = AltArrowsClass;
addline_cell_element.innerHTML = Alternatives_Arrows;
}
else // Message is not sync item
{
mainline_cell_element = main_line_element.insertCell();
mainline_cell_element.className="info_msg";
mainline_cell_element.colSpan="8";
mainline_cell_element.innerHTML = MsgObj.ToString()+CreateMsgButtons(MsgObj);
return;
}
}
function ExtAddNewMsg(MsgCollectionObjID, MsgObjID)
{
var msg = external.ObjByID(MsgObjID);
if(msg == null)
{
alert("msg == null");
return;
}
var Association = msg.GetM('CLASS_CSolutionDoAssociationSync');
AssociationID = Association.objID;
if(G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID] == null)
{
return;
}
G_Associations[AssociationID].TreeView.add_message_node(MsgCollectionObjID, MsgObjID);
}
function ExtChangeMsg(MsgCollectionObjID, MsgObjID)
{
msg = external.ObjByID(MsgObjID);
AssociationID = msg.GetM('CLASS_CSolutionDoAssociationSync').objID;
if(G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID] == null)
{
return;
}
collection_container = document.getElementById('Association_'+AssociationID).all[MsgCollectionObjID+'_container'];
if(msg == null)
{
alert("ExtChangeMsg: Message "+MsgObjID+" does not exist!");
return;
}
if(collection_container == null)
{
if(G_Associations[AssociationID].TreeView.root._children[MsgCollectionObjID]._first_disp_msg != MsgObjID)
{
msg.SetM(MsgCollectionObjID, null); //MM_FlagNotifyScript to null
}
return;
}
message_element = collection_container.children[MsgObjID];
if(message_element != null)
{
if(message_element.className == "Msg_Odd")
{
MsgEvenness = 1;
}
else
{
MsgEvenness = 0;
}
BuildMessageAsObject(message_element, MsgCollectionObjID, MsgObjID, MsgEvenness);
// message_element.scrollIntoView(true);
}
else
{
msg = external.ObjByID(MsgObjID);
msg.SetM(MsgCollectionObjID, null); //MM_FlagNotifyScript to null
}
}
function ExtRemoveMsg(MsgCollectionObjID, MsgObjID)
{
msg = external.ObjByID(MsgObjID);
AssociationID = msg.GetM('CLASS_CSolutionDoAssociationSync').objID;
if(G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID] == null)
{
/* alert('Error 1620: \n'
+'AssociationID = '+AssociationID+',\n'
+'G_Associations = '+G_Associations+',\n'
+'G_Associations['+AssociationID+'] = '+G_Associations[AssociationID]+',\n'
+'G_Associations['+AssociationID+'].TreeView = '+G_Associations[AssociationID].TreeView+',\n'
+'G_Associations['+AssociationID+'].TreeView._collections = '+G_Associations[AssociationID].TreeView._collections+',\n'
+'G_Associations['+AssociationID+'].TreeView._collections['+MsgCollectionObjID+'] = '+G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID]); */
return;
}
msgs = G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID].obj;
msg.SetM(MsgCollectionObjID, null);
collection_node = G_Associations[AssociationID].TreeView.root._children[MsgCollectionObjID];
if(msgs.Method0('M_GetCount') == 0) // if M_GetCount == 0
{
collection_node._first_disp_msg = null;
collection_node._empty = true;
G_Associations[AssociationID].TreeView.redraw_collection(MsgCollectionObjID);
return;
}
if(collection_node._expanded == 0) //Collection collapsed and M_GetCount > 0
{
if(MsgObjID == collection_node._first_disp_msg)
{
collection_node._first_disp_msg = null;
G_Associations[AssociationID].TreeView.redraw_collection(MsgCollectionObjID); //??? May be so...
}
return;
}
collection_container = document.getElementById('Association_'+AssociationID).all[MsgCollectionObjID+'_container'];
deleted_message_element = collection_container.children[MsgObjID];
if(deleted_message_element == null) // Deleted element is not on the page
{
// alert('Deleted element is not on the page');
return;
}
page_length = collection_container.children.length;
if(page_length == 1) // Deleted element is the sole element on the page
{
collection_node._first_disp_msg = msgs.GetFirst().objID;
msgs.ObjByID(collection_node._first_disp_msg).SetM(MsgCollectionObjID, 1); //???
G_Associations[AssociationID].TreeView.redraw_collection(MsgCollectionObjID);
return;
}
if(deleted_message_element.id == collection_container.children[0].id) // Deleted element is the first element on the pege
{
collection_node._first_disp_msg = collection_container.children[1].id;
}
deleted_message_element.removeNode(true); // Delete the element and all it's children
page_length = collection_container.children.length;
AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
if ((msgs.GetLast().objID) != (collection_container.children(page_length-1).id)) // Adds message to the end of the page, if last message is not on it
{
last_on_page_msg = msgs.ObjByID(collection_container.children(page_length-1).id);
var new_last_message_element = document.createElement('tbody');
collection_container.appendChild(new_last_message_element);
New_on_page_message_ID = msgs.GetNext(last_on_page_msg).objID;
if(last_on_page_msg.className == "Msg_Odd")
{
NewMsgEvenness = 0;
}
else
{
NewMsgEvenness = 1;
}
BuildMessageAsObject(new_last_message_element, MsgCollectionObjID, New_on_page_message_ID, NewMsgEvenness);
if(New_on_page_message_ID == msgs.GetLast().objID) //New message on page is last in collection, then remove "Next" control
{
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
RefreshMsgScrollers(document.getElementById('Association_'+AssociationID), "next", false, MsgCollectionObjID, true);
}
}
else
{
AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
if((msgs.GetFirst().objID) != (collection_container.children(0).id))
{
go_prev_message(MsgCollectionObjID);
RefreshMsgScrollers(document.getElementById('Association_'+AssociationID), "next", false, MsgCollectionObjID, true);
}
else
{
RefreshMsgScrollers(document.getElementById('Association_'+AssociationID), "prev", false, MsgCollectionObjID, false);
RefreshMsgScrollers(document.getElementById('Association_'+AssociationID), "next", false, MsgCollectionObjID, false);
}
}
RestoreCollectionZebra(AssociationID, MsgCollectionObjID);
return;
}
function RestoreCollectionZebra(AssociationID, CollectionID)
{
AssociationElement = document.getElementById('Association_'+AssociationID);
collection_container = AssociationElement.all[CollectionID+'_container'];
if(collection_container == null)
{
return;
}
list_length = collection_container.children.length;
FirstMsgEvenness = G_Associations[AssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
for(var i=1; i<list_length; i++)
{
if((FirstMsgEvenness+i)%2 == 0)
{
collection_container.children(i).className = 'Msg_Even';
}
else
{
collection_container.children(i).className = 'Msg_Odd';
}
}
}
function MakeAltArrows(AssociationObj, solution)
{
SyncTreeList = AssociationObj.GetM('CLASS_CSyncTree');
SyncTree1_Obj = SyncTreeList.GetFirst();
SyncTree2_Obj = SyncTreeList.GetNext(SyncTree1_Obj);
SyncTreeId_1 = SyncTree1_Obj.GetM('MM_TreeID');
SyncTreeId_2 = SyncTree2_Obj.GetM('MM_TreeID');
file1_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_1);
file2_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_2);
Alternatives_Arrows = '';
arrow_shift=1;
tooltip_1 = external.LS("tooltip_copy")+' '+file1_name+' '+external.LS("tooltip_to")+' '+file2_name;
Alternatives_Arrows += '<img style="position:relative; left:'+arrow_shift+'px; top:0px; cursor:hand; " onclick=OnArrowClick("'+
solution.objID+'","'+ SyncTreeId_1+ '") onmousedown=ArrowButtonPressed("right") '+
' onmouseover=ArrowButtonHi("right","on") onmouseout=ArrowButtonHi("right","off")'+
' src="Pics/Arrow1_but.gif" title="'+tooltip_1+'">';
arrow_shift+=0;
tooltip_1 = external.LS("tooltip_copy")+' '+file2_name+' '+external.LS("tooltip_to")+' '+file1_name;
Alternatives_Arrows += '<img style="position:relative; left:'+arrow_shift+'px; top:0px; cursor:hand; " onclick=OnArrowClick("'+
solution.objID+'","'+ SyncTreeId_2+ '") onmousedown=ArrowButtonPressed("left") '+
'onmouseover=ArrowButtonHi("left","on") onmouseout=ArrowButtonHi("left","off")'+
' src="Pics/Arrow2_but.gif" title="'+tooltip_1+'">';
arrow_shift+=0;
tooltip_1 = external.LS("tooltip_CID_arrow");
Alternatives_Arrows += '<img style="position:relative; left:'+arrow_shift+'px; top:0px; cursor:hand; " onclick=OnArrowClick("'+
solution.objID+'","CID") onmousedown=ArrowButtonPressed("CID") '+
'onmouseover=ArrowButtonHi("CID","on") onmouseout=ArrowButtonHi("CID","off")'+
' src="Pics/Arrow3_but.gif" title="'+tooltip_1+'">';
return Alternatives_Arrows;
};
function ArrowButtonHi(button_direction,hi)
{
arr_button = window.event.srcElement;
var Picture = document.getElementById('Association_'+G_ActiveAssociationID).all['Flying_picture'];
if(button_direction == "right")
if(hi == "on")
{
arr_button.src = "Pics/Arrow1_but_hi.gif";
Picture.src = 'Pics/DocToRight.gif';
}
else
{
arr_button.src = "Pics/Arrow1_but.gif";
Picture.src = 'Pics/MiddleArrow40.gif';
}
else if(button_direction == "left")
if(hi == "on")
{
arr_button.src = "Pics/Arrow2_but_hi.gif";
Picture.src = 'Pics/DocToLeft.gif';
}
else
{
arr_button.src = "Pics/Arrow2_but.gif";
Picture.src = 'Pics/MiddleArrow40.gif';
}
else if(button_direction == "CID")
if(hi == "on")
{
arr_button.src = "Pics/Arrow3_but_hi.gif";
}
else
{
arr_button.src = "Pics/Arrow3_but.gif";
}
}
function ArrowButtonPressed(button_direction)
{
arr_button = window.event.srcElement;
if(button_direction == "right")
arr_button.src = "Pics/Arrow1_but_press.gif";
if(button_direction == "left")
arr_button.src = "Pics/Arrow2_but_press.gif";
if(button_direction == "CID")
arr_button.src = "Pics/Arrow3_but_press.gif";
}
function ShowAltArrows()
{
more_element = window.event.srcElement;
MsgID = more_element.parent_msg_id;
AssociationID = more_element.association_id;
AssociationObj = external.ObjByID(AssociationID);
MsgObj = external.ObjByID(MsgID);
if(MsgObj.IsSyncItemMsg())
{
solution = MsgObj.GetObjM('MM_Solution');
if(solution == null)
{
alert("solution == null");
return "";
}
message_element = more_element;
for(i=0; i<3; i++)
{
message_element = message_element.parentElement;
}
arrows_element = message_element.all["AlternativesArrows"];
arrows_element.className = "AltButtonsExpanded";
arrows_element.innerHTML = MakeAltArrows(AssociationObj, solution);
tooltip = external.LS("tooltip_hide_alt");
more_element.src = "Pics/More_up.gif";
more_element.onclick = HideAltArrows;
more_element.title = external.LS("tooltip_hide_alt");
}
else
{
return '';
}
}
function HideAltArrows()
{
more_element = window.event.srcElement;
MsgID = more_element.parent_msg_id;
MsgObj = external.ObjByID(MsgID);
if(MsgObj.IsSyncItemMsg())
{
solution = MsgObj.GetObjM('MM_Solution');
if(solution == null)
{
alert("solution == null");
return "";
}
message_element = more_element;
for(i=0; i<3; i++)
{
message_element = message_element.parentElement;
}
arrows_element = message_element.all["AlternativesArrows"];
arrows_element.className = "AltButtonsCollapsed";
arrows_element.innerHTML = "";
tooltip = external.LS("tooltip_more_alt");
more_element.src = "Pics/More.gif";
more_element.onclick = ShowAltArrows;
more_element.title = external.LS("tooltip_more_alt");
}
else
{
return "";
}
}
function CreateSyncItemCharacteristics(solution,TreeID)
{
this.name = '';
this.size = '';
this.time = '';
this.state = '';
this.if_missing = false;
file_SIC= solution.Method1IDOwn('M_GetSyncItemCharacteristicsByTreeID',TreeID);
this.name = solution.Method1ID('M_CreateFullPathStrByTreeID',TreeID);
this.name = this.name.replace(/\\/g,"\\<wbr>");
SolutionActionState = solution.GetM('MM_ActionState');
if(SolutionActionState == C_ACTION_STATE_DONE)
{
AfterActionState = solution.Method1IDOwn('M_GetActionDoneUserStrByTreeID',TreeID);
if(AfterActionState != null)
{
this.state = AfterActionState;
return this;
}
}
if(file_SIC.GetM('MM_Missing') == 1)
{
this.state = external.LS("str_not_exist");
this.if_missing = true;
return this;
}
file_size = file_SIC.Method0('M_GetFileSizeStr');
if(file_size != null)
{
this.size = file_size;
}
file_time = file_SIC.Method0('M_GetFiletimeStr');
if(file_time != null)
{
this.time = file_time;
}
return this;
}
function CreateMsgButtons(MsgObj)
{
var msg_buttons = MsgObj.GetObjM('MM_UserButtons');
buttons_html = "";
if(msg_buttons != null)
{
buttons_html += "<br/>";
var button = msg_buttons.GetFirst();
buttons_html += '<span style="white-space:nowrap; padding-left:20px;">';
while(button)
{
buttons_html += '<BUTTON onclick=OnMsgButton("' + button.objID + '") class="msg_button">' +
button.ToString() +
'</BUTTON>';
button = msg_buttons.GetNext(button);
}
buttons_html += '</span>';
}
/* buttons_html = '<span style="white-space:nowrap; padding-left:20px;"><BUTTON class="msg_button">Test_1</BUTTON>'
+'<BUTTON class="msg_button">Test_2</BUTTON>'+
'<BUTTON class="msg_button">Test_3</BUTTON></span>';*/
return buttons_html;
}
function OnArrowClick(SolutionID,TreeID)
{
document.getElementById('Association_'+G_ActiveAssociationID).all['Flying_picture'].src = 'Pics/MiddleArrow40.gif';
solution = external.ObjByID(SolutionID);
solution.Method1ID('M_AlternativeSelected',TreeID);
}
function OnMsgButton(button_objID)
{
var button = external.ObjByID(button_objID);
if(button == null) return;
button.Method('M_ButtonPressed');
}
function Ok_Activate(num)
{
Form_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["TreeForm"+num];
SyncTreeID = Form_elem.parentElement.synctree_id;
new_path = Form_elem.all[SyncTreeID+'_path'].value;
if(Form_elem.is_empty == "false")
{
old_path = external.ObjByID(SyncTreeID).Method0Own('M_CreateTreeRootPath').Method0Own('M_ToFilename');
}
else
{
old_path = "";
}
if(new_path != old_path)
{
Form_elem.all["TreeOk"+num].disabled = false;
Form_elem.all["TreeCancel"+num].disabled = false;
Form_elem.is_changed = "true";
}
else
{
Form_elem.all["TreeOk"+num].disabled = true;
Form_elem.all["TreeCancel"+num].disabled = true;
Form_elem.is_changed = "false";
}
}
function GetBackSyncBoard(num)
{
SyncTree_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
SyncTreeID = SyncTree_elem.synctree_id;
SyncTreeObj = external.ObjByID(SyncTreeID);
if(SyncTreeObj.Method0('M_IsTreeReady') == 1)
{
SyncTree_path = SyncTreeObj.Method0Own('M_CreateTreeRootPath').Method0Own('M_ToFilename');
if_empty = "false";
}
else
{
SyncTree_path ="";
if_empty = "true";
}
SyncTree_elem.all[SyncTreeID+"_path"].value = SyncTree_path;
SyncTree_elem.all["TreeForm"+num].is_changed = "false";
SyncTree_elem.all["TreeForm"+num].is_empty = if_empty;
SyncTree_elem.all["TreeOk"+num].disabled = true;
SyncTree_elem.all["TreeCancel"+num].disabled = true;
}
function ExtOnProfileChanged()
{
if(Flag_can_reload_profile == false)
{
return;
}
RemoveAllAssociationsFromScreen();
LoadProfile();
ActivateAssociation(G_ActiveAssociationID);
ExtUpdateButtons(G_ActiveAssociationID);
}
function BuildAssociationTabsCaption(profileObj)
{
FirstAssociationID = profileObj.GetFirst().objID;
Association = profileObj.GetLast();
what_before = "empty"; // active, unactive
Active_was_found = false;
i=1;
while(Association != null)
{
if((Active_was_found == false)&&(Association.objID == FirstAssociationID))
{
G_ActiveAssociationID = Association.objID;
}
separator_cell = TabsLabels.insertCell(0);
Label_cell = TabsLabels.insertCell(0);
if(Association.objID != G_ActiveAssociationID)
{
if(what_before == "unactive")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart7.gif">';
}
else if(what_before == "active")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart5.gif">';
}
else if(what_before == "empty")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart4.gif">';
}
Label_cell.innerHTML = 'Association #'+i;
Label_cell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
Label_cell.noWrap = true;
what_before = "unactive";
}
else
{
Active_was_found = true;
if(what_before == "unactive")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart6.gif">';
}
else if(what_before == "empty")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart2.gif">';
}
Label_cell.innerHTML = 'Association #'+i;
Label_cell.style.backgroundImage = "url('Pics/TabCaptionMid2.gif')";
Label_cell.noWrap = true;
what_before = "active";
}
i++;
Association = association_list.GetPrev(Association);
}
End_separator_cell = TabsLabels.insertCell(0);
if(what_before == "active")
{
End_separator_cell.innerHTML = '<img src="Pics/TabCaptionPart1.gif">';
}
else
{
End_separator_cell.innerHTML = '<img src="Pics/TabCaptionPart3.gif">';
}
}
function BuildAssociationTabsCaption_Debug()
{
LabelsNumber = 9;
ActiveLabel = 4;
what_before = "empty"; // active, unactive
Active_was_found = false;
for(i=LabelsNumber; i>0; i--)
{
if((Active_was_found == false)&&(i == 1))
{
ActiveLabel = 1;
}
separator_cell = TabsLabels.insertCell(0);
Label_cell = TabsLabels.insertCell(0);
if(i != ActiveLabel)
{
if(what_before == "unactive")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart7.gif">';
}
else if(what_before == "active")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart5.gif">';
}
else if(what_before == "empty")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart4.gif">';
}
Label_cell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
what_before = "unactive";
}
else
{
Active_was_found = true;
G_ActiveAssociationID = 'Association'+i+'ID';
if(what_before == "unactive")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart6.gif">';
}
else if(what_before == "empty")
{
separator_cell.innerHTML = '<img src="Pics/TabCaptionPart2.gif">';
}
Label_cell.style.backgroundImage = "url('Pics/TabCaptionMid2.gif')";
what_before = "active";
}
Label_cell.noWrap = true;
Label_cell.innerHTML = 'Association #'+i;
Label_cell.id = 'Association'+i+'ID';
Label_cell.onmousedown = TabLabelOnClick;
Label_cell.style.cursor = "hand";
}
End_separator_cell = TabsLabels.insertCell(0);
if(what_before == "active")
{
End_separator_cell.innerHTML = '<img src="Pics/TabCaptionPart1.gif">';
}
else
{
End_separator_cell.innerHTML = '<img src="Pics/TabCaptionPart3.gif">';
}
}
function Activate_form(num)
{
SyncTree_obj = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
{
SyncTree_obj.className = "Active_panel";
}
}
function Deactivate_form(num)
{
ExtCloseHint(AssociationID, "Syncpath_hint_"+num);
AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
SyncTree_elem = AssociationElement.all["SyncTree"+num];
Form_elem = AssociationElement.all["TreeForm"+num];
if(Form_elem.is_changed == "false")
{
SyncTree_elem.className = "Unactive_panel";
}
else if(SyncTree_elem.contains(window.event.toElement) == false)
{
SyncTree_elem.className = "Unactive_panel";
ChangeSyncTree(num);
}
}
function CancelSyncTree(num)
{
SyncTree_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
SyncTree_elem.className = "Unactive_panel";
GetBackSyncBoard(num);
}
function BrowseSyncTree(num)
{
SyncTree_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
SyncTreeID = SyncTree_elem.synctree_id;
SyncTree_elem.className = "Unactive_panel";
G_OnProfileChanged_called = false;
external.Method1ID('M_BrowseButtonPressedForTree', SyncTreeID);
if(G_OnProfileChanged_called == false)
{
GetBackSyncBoard(num);
}
}
function OpenSyncTree(num)
{
SyncTree_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
SyncTreeID = SyncTree_elem.synctree_id;
ChangeSyncTree(num);
external.Method1ID('M_OpenButtonPressedForTree', SyncTreeID);
}
function ChangeSyncTree(num)
{
ExtCloseHint(G_ActiveAssociationID, "Syncpath_hint_"+num);
AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
SyncTree_elem = AssociationElement.all["SyncTree"+num];
SyncTreeID = SyncTree_elem.synctree_id;
SyncTree_elem.className = "Unactive_panel";
Form_elem = AssociationElement.all["TreeForm"+num];
if(Form_elem.is_changed == "true")
{
Form_elem.is_changed = "false";
new_path = AssociationElement.all[SyncTreeID+'_path'].value;
G_Associations[G_ActiveAssociationID].OnAssociationChangedCalled = false;
solution = external.method0Own('M_GetSynchronizeProfileSolution');
solution.SafeChangeTreePathAndUpdateProfile(SyncTreeID, new_path);
if(G_Associations[G_ActiveAssociationID].OnAssociationChangedCalled == false)
{
GetBackSyncBoard(num);
}
}
return false;
}
function Analyze_onclick()
{
AnalyzeButtonElement = window.event.srcElement;
AssociationID = AnalyzeButtonElement.association_id;
ExtCloseHint(AssociationID, 'Analyze_hint');
AssociationObj = external.ObjByID(AssociationID);
AssociationObj.CommandAnalyze();
}
function Synchronize_onclick()
{
SynchronizeButtonElement = window.event.srcElement;
AssociationID = SynchronizeButtonElement.association_id;
// ExtCloseHint(AssociationID, 'Synchronize_hint');
AssociationObj = external.ObjByID(AssociationID);
AssociationObj.CommandSynchronize();
}
function Stop_onclick()
{
StopButtonElement = window.event.srcElement;
AssociationID = StopButtonElement.association_id;
AssociationObj = external.ObjByID(AssociationID);
AssociationObj.CommandStop();
}
function CloseAnalyzeHint()
{
AnalyzeButtonElement = window.event.srcElement;
ExtCloseHint(AnalyzeButtonElement.association_id, 'Analyze_hint');
}
function ExtUpdateButtons(AssociationID)
{
AssociationElement = document.getElementById('Association_'+AssociationID);
if(AssociationElement == null)
{
return;
}
AssociationObj = external.ObjByID(AssociationID);
AssociationElement.all['B_ANALYZE'].disabled = !AssociationObj.StatusAnalyze;
if(G_Associations[AssociationID].Folders_is_ready == true)
{
DisableFSP(AssociationID, 1, !AssociationObj.StatusAnalyze, true);
DisableFSP(AssociationID, 2, !AssociationObj.StatusAnalyze, true);
}
else
{
DisableFSP(AssociationID, 1, false, G_Associations[AssociationID].Folder_1_is_ready);
DisableFSP(AssociationID, 2, false, G_Associations[AssociationID].Folder_2_is_ready);
}
AssociationElement.all['B_SYNC'].disabled = !AssociationObj.StatusSynchronize;
AssociationElement.all['B_STOP'].disabled = !AssociationObj.StatusStop;
}
function DisableFSP(AssociationID, FSPnum, if_disabled, Open_is_enabled)
{
SyncTree_element = document.getElementById('Association_'+AssociationID).all["SyncTree"+FSPnum];
SyncTree_element.all["TreePath"+FSPnum].disabled = if_disabled;
SyncTree_element.all["TreeSubmitButtons"+FSPnum].disabled = if_disabled;
SyncTree_element.all["TreeBrowse"+FSPnum].disabled = if_disabled;
SyncTree_element.all["TreeOpen"+FSPnum].disabled = !Open_is_enabled;
}
function ExtGiveHint(AssociationID, Hint_element_id)
{
if(AssociationID != G_ActiveAssociationID)
{
return;
}
hint_element = document.getElementById('Association_'+AssociationID).all[Hint_element_id];
if(Hint_element_id == "Syncpath_hint_1")
{
hint_element.innerHTML = '<div style="position:absolute; top:0; left:0; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow1.png\'); z-index:10"></div>'+
'<div style="position:absolute; top:18; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
external.LS("hint_syncpath_left")+'</div>';
hint_element.style.visibility = "inherit";
}
else if(Hint_element_id == "Syncpath_hint_2")
{
hint_width = hint_element.offsetWidth-17;
arrow_left = hint_element.offsetWidth-26;
hint_element.innerHTML = '<div style="position:absolute; top:0; left:'+arrow_left+'; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow2.png\'); z-index:10"></div>'+
'<div style="position:absolute; top:18; left:0; width:'+hint_width+';padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
external.LS("hint_syncpath_right")+'</div>';
hint_element.style.visibility = "inherit";
}
else if(Hint_element_id == "Analyze_hint")
{
hint_element.innerHTML = '<div style="position:relative; top:0; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
external.LS("hint_analyze")+'</div>'+
'<div style="position:relative; left:0; right:0; width:250px; height:18px;">'+
'<div style="position:absolute; top:-8; left:0; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow3.png\'); z-index:10"></div></div>'
hint_height = hint_element.offsetHeight;
hint_element.style.top = -5-hint_height;
hint_element.style.visibility = "inherit";
}
else if(Hint_element_id == "Synchronize_hint")
{
hint_element.innerHTML = '<div style="position:relative; top:0; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
external.LS("hint_synchronize")+'</div>'+
'<div style="position:relative; left:0; right:0; width:250px; height:18px;">'+
'<img src="Pics/Hint_arrow3.gif" style="position:absolute; top:-8; left:0; z-index:10"></div>'
hint_height = hint_element.offsetHeight;
hint_element.style.top = -5-hint_height;
hint_element.style.visibility = "inherit";
}
}
function ExtCloseHint(AssociationID, Hint_element_id)
{
hint_element = document.getElementById('Association_'+AssociationID).all[Hint_element_id];
hint_element.innerHTML = "";
hint_element.style.visibility = "hidden";
}
function ScrollToImportant()
{
AssociationID = G_ActiveAssociationID;
ImportantID = G_Associations[AssociationID].TreeView._collectionIdByName['Important'];
if(G_Associations[AssociationID].TreeView.root._children[ImportantID]._expanded == 0)
{
OnCollectionExpandIconClick(AssociationID, ImportantID);
}
ImportantCollectionElement = document.getElementById('Association_'+AssociationID).all[ImportantID];
ImportantCollectionElement.scrollIntoView();
}
function TabsCaptionResized()
{
if(TabsCaption.scrollLeft>0)
{
LeftTabScroller.src = "Pics/TabCaptionScroller1.gif";
LeftTabScroller.onmousedown = LeftTabScrollerDown;
LeftTabScroller.onmouseup = TabScrollerReleased;
LeftTabScroller.onmouseout = TabScrollerReleased;
}
else
{
LeftTabScroller.src = "Pics/TabCaptionScroller0.gif";
LeftTabScroller.onmousedown = '';
}
if(TabsCaption.scrollWidth-TabsCaption.clientWidth-TabsCaption.scrollLeft >0)
{
RightTabScroller.src = "Pics/TabCaptionScroller2.gif";
RightTabScroller.onmousedown = RightTabScrollerDown;
RightTabScroller.onmouseup = TabScrollerReleased;
RightTabScroller.onmouseout = TabScrollerReleased;
}
else
{
RightTabScroller.src = "Pics/TabCaptionScroller0.gif";
RightTabScroller.onmousedown = '';
}
}
function TabLabelOnClick()
{
TabLabelClickedCell = window.event.srcElement;
DeactivateAssociation(G_ActiveAssociationID);
LabelID = TabLabelClickedCell.id;
AssociationID = LabelID.replace(/Label_/,"");
ActivateAssociation(AssociationID);
}
function ScrollTabLabelIntoView(AssociationID)
{
LabelCell = TabsLabels.cells['Label_'+AssociationID];
LeftLabelOut = TabsCaption.scrollLeft - LabelCell.offsetLeft+15;
RightLabelOut = (LabelCell.offsetLeft+LabelCell.offsetWidth+16) - (TabsCaption.scrollLeft+TabsCaption.clientWidth);
if((LeftLabelOut<0)&&(RightLabelOut<0))
{
return;
}
else if(LeftLabelOut<0)
{
ScrollTabToRightPixels(RightLabelOut);
}
else if(RightLabelOut<0)
{
ScrollTabToLeftPixels(LeftLabelOut);
}
else if((LeftLabelOut>0)&&(RightLabelOut>0))
{
if(LeftLabelOut > RightLabelOut)
{
ScrollTabToRigthPixels(RightLabelOut);
}
else
{
ScrollTabToLeftPixels(LeftLabelOut);
}
}
}
function LeftTabScrollerDown()
{
G_TabScrollingProcessNum++;
RightTabScroller.src = "Pics/TabCaptionScroller2.gif";
RightTabScroller.onmousedown = RightTabScrollerDown;
RightTabScroller.onmouseup = TabScrollerReleased;
RightTabScroller.onmouseout = TabScrollerReleased;
ScrollTabToLeft(G_TabScrollingProcessNum);
}
function RightTabScrollerDown()
{
G_TabScrollingProcessNum++;
LeftTabScroller.src = "Pics/TabCaptionScroller1.gif";
LeftTabScroller.onmousedown = LeftTabScrollerDown;
LeftTabScroller.onmouseup = TabScrollerReleased;
LeftTabScroller.onmouseout = TabScrollerReleased;
ScrollTabToRight(G_TabScrollingProcessNum);
}
function TabScrollerReleased()
{
G_TabScrollingProcessNum++;
}
function ScrollTabToLeft(ProcessNum)
{
if(ProcessNum == G_TabScrollingProcessNum)
{
if(TabsCaption.scrollLeft >5)
{
TabsCaption.scrollLeft -= 5;
window.setTimeout("ScrollTabToLeft("+ProcessNum+")", 5);
}
else
{
TabsCaption.scrollLeft = 0;
LeftTabScroller.src = "Pics/TabCaptionScroller0.gif";
LeftTabScroller.onmousedown = '';
}
}
}
function ScrollTabToRight(ProcessNum)
{
if(ProcessNum == G_TabScrollingProcessNum)
{
if(TabsCaption.scrollWidth-TabsCaption.clientWidth-TabsCaption.scrollLeft >5)
{
TabsCaption.scrollLeft += 5;
window.setTimeout("ScrollTabToRight("+ProcessNum+")", 5);
}
else
{
TabsCaption.scrollLeft = TabsCaption.scrollWidth-TabsCaption.clientWidth;
RightTabScroller.src = "Pics/TabCaptionScroller0.gif";
RightTabScroller.onmousedown = '';
}
}
}
function ScrollTabToLeftPixels(PixelNumber)
{
if(PixelNumber > TabsCaption.scrollLeft)
{
PixelNumber = TabsCaption.scrollLeft;
}
/* if(PixelNumber > 10)
{
TabsCaption.scrollLeft -= 10;
window.setTimeout("ScrollTabToLeftPixels("+(PixelNumber-10)+")", 5);
}
else */
{
TabsCaption.scrollLeft = TabsCaption.scrollLeft-PixelNumber;
TabsCaptionResized();
}
}
function ScrollTabToRightPixels(PixelNumber)
{
if(PixelNumber > TabsCaption.scrollWidth - TabsCaption.clientWidth - TabsCaption.scrollLeft)
{
PixelNumber = TabsCaption.scrollWidth - TabsCaption.clientWidth - TabsCaption.scrollLeft;
}
/* if(PixelNumber > 3)
{
TabsCaption.scrollLeft += 3;
window.setTimeout("ScrollTabToRightPixels("+(PixelNumber-3)+")", 1);
}
else */
{
TabsCaption.scrollLeft = TabsCaption.scrollLeft+PixelNumber;
TabsCaptionResized();
}
}
function CloseAnalizeHint()
{
AnalyzeButtonElement = window.event.srcElement;
AssociationID = AnalyzeButtonElement.association_id;
ExtCloseHint(AssociationID, 'Analyze_hint');
}
function ExtAddNewAssociation()
{
NewAssociation();
}
function ExtGetSelectedAssociation()
{
if(G_ActiveAssociationID != '')
{
var ActiveAssociationObj = external.ObjByID(G_ActiveAssociationID);
return ActiveAssociationObj;
}
else
{
return null;
}
} // return assocition (not obj ID)
function ExtSelectAssociation(AssociationObjID)
{
DeactivateAssociation(G_ActiveAssociationID);
ActivateAssociation(AssociationObjID);
}
function RenameAssociation()
{
ExtAskNewAssociationName(G_ActiveAssociationID);
}
function ExtAskNewAssociationName(AssociationID)
{
/* LabelCell = TabsLabels.cells['Label_'+AssociationID];
LabelCell.innerHTML = '<input type="text" value="" style="width:150px; border:none;">';
window.setTimeout('TabsLabels.cells["Label_'+AssociationID+'].children(0).focus()',0); */
// alert('ExtAskNewAssociationName('+AssociationID+')');
var AssociationObj = external.ObjByID(AssociationID);
var OldName = AssociationObj.Method0('443EF11F46C9207C2C595B7B21499882'); //M_GetAssociationName
var NewAssociationName = prompt('Association\'s new name:', OldName);
if(NewAssociationName == null)
{
return;
}
if(NewAssociationName == '')
{
NewAssociationName = 'Association #'+G_LastAssociationNumber;
G_LastAssociationNumber++;
}
else if(NewAssociationName == 'Association #'+G_LastAssociationNumber)
{
G_LastAssociationNumber++;
}
AssociationObj.Method1('45AB23FF99C4F08EFCD8EF9AFF1371B3', NewAssociationName); //M_SetAssociationName
var LabelCell = TabsLabels.cells['Label_'+AssociationID];
LabelCell.innerText = NewAssociationName;
} // call M_SetAssociationName